//============================================================================
// Name        : mgd-solver.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include "basic structs.h"
using namespace std;

static vector<gas_cell_t> mesh;
static gas_cell_t inflow, outflow;

void init_wall() {
  inflow.gas.p = 10.0;
  inflow.gas.vx = 1.0;
  inflow.gas.vy = 1.0;

  outflow.gas.p = 10.0;
  outflow.gas.vx = 1.0;
  outflow.gas.vy = 1.0;
}

// direct simple flow in tube
void init_mesh() {
  mesh.resize(10);

  // gas-params
  for (int i = 0; i < 10; i++) {
    mesh[i].gas.p = 10.0;
    mesh[i].gas.vx = 1.0;
    mesh[i].gas.vy = 0.0;
  }

  // geom-params
  for (int i = 0; i < 10; i++) {
    mesh[i].cell.x = (int)(i/2);
    mesh[i].cell.y = i % 2;
  }

  // nbrs-relations
  for (int i = 0; i < 10; i++) {
    mesh[i].cell.nbrs_q = 4; // 2-D version
    mesh[i].cell.nbrs.resize(4);
    mesh[i].cell.nbrs[0] = i+1;
    mesh[i].cell.nbrs[1] = i+2;
    mesh[i].cell.nbrs[2] = i-1;
    mesh[i].cell.nbrs[3] = i-2;
    for (int j = 0; j < 4; j++) {
      if (i % 2) mesh[i].cell.nbrs[0] = -1;        // wall
      if (i % 2 ==0) mesh[i].cell.nbrs[2] = -1;    // wall
      if (i==1 || i==0) mesh[i].cell.nbrs[3] = -2; // inflow
      if (i==9 || i==8) mesh[i].cell.nbrs[1] = -3; // outflow
    }
  }
}

void solver(vector<double>* U, vector<vector<double> >& A) {



}

void step_solver() {
  for (int i = 0; i < mesh.size(); i++) {

  }
}

int main() {

  init_mesh();
  init_wall();
  cout << "Hello World++!!!" << endl; // prints !!!Hello World++!!!
  return 0;
}
